package com.dfiov.cloud.msmtools.controller;

import com.dfiov.cloud.msmtools.service.bussiness.impl.RedisViewServiceImpl;
import com.pateo.qingcloud.framework.common.base.BaseRestResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "查看redis键对应的值")
@RestController
@RequestMapping("/redisview")
public class RedisViewController {
    @Resource
    private RedisViewServiceImpl redisUseService;

    @GetMapping("/view")
    @ApiImplicitParams({
            @ApiImplicitParam(name="dataBase",value ="数据库序列号"),
            @ApiImplicitParam(name="redisChoose",value ="1是redis1,2是redis2,3是redis3，4是redis4")
    })
    public BaseRestResponse viewRedisValue(@RequestParam String key,
                                           @RequestParam String dataBase,
                                           @RequestParam String redisChoose){
        return redisUseService.viewValue(key,dataBase,redisChoose);
    }
}
